<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<%@ include file="/common/ssb/include/common-base.jsp"%>
	<title>提现审核</title>
	<!-- Tell the browser to be responsive to screen width -->
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>

<!-- Part 一、 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

	<!-- top start -->
	<%@include file="/common/ssb/top.jsp" %>
	<!-- top end -->
	<!-- left start -->
	<%@include file="/common/ssb/left.jsp" %>
	<!-- left end-->

	<div class="content-wrapper">
		<!-- Main start -->
		<section class="content">
			<div id="div_hidden_content" class="hidden" style="display:none;">
				<input name="templateType" type="hidden" value="all"/>
				<div id="hidden_common_final">
					<!-- temp="hidden_common_final" start -->
					<input name="mainObjName" type="hidden" value="ssCashApply">
					<input name="mainObjPrimaryKey" type="hidden" value="infoId">
					<input name="objNameAll" type="hidden" value="ssCashApply">
					<!-- temp="hidden_common_final" end -->
				</div>
				<!-- temp="delForm_hidden" start -->
				<div id="delForm_hidden">
				</div>
				<!-- temp="delForm_hidden" end -->
			</div>
			<div class="row">
				<div class="col-xs-12">

					<!------搜索  start ------->
					<div class="box box-info">
						<!--搜索title  start -->
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-search"></i> 提现审核搜索</h3>
							<div class="box-tools pull-right">
								<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
							</div>
						</div>
						<!--搜索title  end -->
						<div class="box-body">
							<form id="searchForm" action="javascript:;">
								<!-- temp="searchForm_hidden" start -->
								<div id="searchForm_hidden" style="display:none;">
									<input type="hidden" name="pageName" value="ss-cash-apply"/>
									<input type="hidden" name="formName" value="searchForm"/>
									<input type="hidden" name="objName" value="ssCashApply"/>
									<input type="hidden" name="templateName" value="cashOut.xls"/>
									<input type="hidden" name="orderBy" value="ssCashApply.apply_status,ssCashApply.create_time desc"/>
									<input type="hidden" name="ssCashApply.wb_modifyTime" size="30" class="clean" value=""/>
								</div>
								<!-- temp="searchForm_hidden" end -->

								<!-- temp="searchForm_content" start -->
								<div id="searchForm_content" class="form-group"  data-temp-code="true" data-temp-type="searchForm" data-temp-form-id="searchForm">


									<table class="table table-bordered bordercolor" >
										<tbody>
										<tr>
											<td class="active" align="right"><label class="form-control-static">申请人名称：</label></td>
											<td>
												<div class="form-group"><input type="text" class="form-control clean" name="ssCashApply.wl_applyCname"></div>
											</td>
											<td class="active" align="right"><label
													class="form-control-static">状态：</label></td>
											<td>
												<div class="form-group"><select id="searchForm_ssCashApply_applyStatus"
																				name="ssCashApply.wl_applyStatus"
																				class="form-control  clean"
																				data-temp-obj="ssCashApply.applyStatus"
																				data-dict-code="dictItemList"
																				data-dict-cate="cashApplyStatus"
																				data-type-tag="select" data-def="">
													<option value="">--请选择--</option>
												</select></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label
													class="form-control-static">审核时间：</label></td>
											<td colspan="2">
												<div class="form-group">
													<div class="input-group ">
														<input id="searchForm_input_startDate" name="input_startDate" maxlength="30" class="form-control clean datepicker" readonly="readonly" type="text">
														<span class="input-group-addon"> <i class="fa fa-calendar"></i></span>
														<span class="input-group-addon"> 至 </span>
														<input id="searchForm_input_endDate"  name="input_endDate" maxlength="30" class="form-control clean datepicker" readonly="readonly" type="text">
														<span class="input-group-addon"> <i class="fa fa-calendar"></i></span>
													</div>
												</div>
											</td>
											<td>
												<div class="form-group">
													<button class="btn btn-default" type="button" onclick="getStartEndByDate('m')">当月</button>
												</div>
											</td>
										</tr>
										</tbody>
									</table>
								</div>
								<!-- temp="searchForm_content" end -->
							</form>
							<div class="box-footer text-center">
								<button type="button" class="btn btn-success" onclick="getTableData();" data-temp-event="searchForm_hidden"><i class="fa fa-search"></i> 查询</button> 
								<button type="button" class="btn btn-warning" onclick="mytools.cleanData('#searchForm');">重置 </button>
							</div>
						</div>
					</div>
					<!------- 搜索 end -------->

					<!------- 列表 start -------->
					<div class="box box-success">
						<!--列表title  start -->
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-table"></i> 查询结果
								<button id="button_to_export" onclick="toExport();" class="btn btn-primary" type="button"><i class="fa fa-download"></i> 导出 </button>
							</h3>
							<div class="box-tools pull-right">
								<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
							</div>
						</div>
						<div class="box-body">
							<table id="dataList" class="table table-bordered table-hover">
								<thead>
								<tr id="dataList_thead_content" data-temp-code="true" data-temp-type="table" data-temp-show="dataList_template_content">
									<th>序号</th>
									<!-- temp="dataList_thead_content" start -->

									<th data-temp-obj="ssCashApply.applyCname">申请人名称</th>
									<th data-temp-obj="ssCashApply.money">提现金额</th>
									<th data-temp-obj="ssCashApply.applyCertNo">身份证号</th>
									<th data-temp-obj="ssCashApply.applyCardNum">银行卡号</th>
									<th data-temp-obj="ssCashApply.applyCardName">开户人姓名</th>
									<th data-temp-obj="ssCashApply.applyCardType">开户银行</th>
									<th data-temp-obj="ssCashApply.auditUserCname">审核人名称</th>
									<th data-temp-obj="ssCashApply.createTime">创建时间</th>
									<th data-temp-obj="ssCashApply.modifyTime">审核时间</th>
									<th data-temp-obj="ssCashApply.applyStatus" data-th-dict-code="dictItemList" data-dict-cate="cashApplyStatus" data-page-name="" data-form-name="">申请状态</th>
									<th>操作</th>
									<!-- temp="dataList_thead_content" end -->
								</tr>
								</thead>
								<tbody id="dataList-body">

								</tbody>
							</table>
						</div>

						<div class="box-footer text-center">
							<ul id="dataList-page" class="pagination">
							</ul>
						</div>
					</div>
					<!------- 列表 end -------->
				</div>
			</div>


			<div win-title="审核窗口" class="modal fade" id="my_modal_view" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:40%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">审核窗口</font> 
							</h4>
							<form id="viewForm" action="javascript:void(0)">
								<!-- temp="viewForm_hidden" start -->
								<div id="viewForm_hidden" style="display:none;"></div>
								<!-- temp="viewForm_hidden" end -->
							</form>
						</div>
						<div class="modal-body viewForm">

							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-view">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabView_1">
										<form class="form-horizontal" role="form" id="viewForm1" action="javascript:void(0)">

											<input type="hidden" class="formToken" id="viewForm1_formToken" name="formToken" />
											<!-- temp="addForm1_hidden" start -->
											<div id="viewForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="ss-cash-apply"/>
												<input type="hidden" name="formName" value="editForm"/>
												<input type="hidden" name="type" value="audit"/>
												<input type="hidden" name="ssCashApply.applyStatus" value="90"/>
												<input type="hidden" name="ssCashApply.w_infoId" data-name="ssCashApply.infoId"/>
												<input type="hidden" name="ssCashApply.applyEname" data-name="ssCashApply.applyEname"/>
												<input type="hidden" name="ssCashApply.auditUserEname" value="${loginUser.userEname}"/>
												<input type="hidden" name="ssCashApply.auditUserCname" value="${loginUser.userCname}"/>
												<input type="hidden" name="ssCashApply.money" data-name="ssCashApply.money"/>
											</div>
											<!-- temp="addForm1_hidden" end -->
											<!-- temp="viewForm1_content" start -->
											<div id="viewForm1_content" class="row viewForm">
												<table class="table table-bordered bordercolor">
													<tbody>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请人账号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyEname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请人名称：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请提现金额：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.money"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">身份证号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCertNo"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">银行卡号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardNum"></span></div>
														</td>
													</tr>

													<tr>
														<td class="active" align="right"><label
																class="form-control-static">开户人姓名：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardName"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">开户银行：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardType"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">处理状态：</label></td>
														<td>
															<div class="form-control-static"><span
																	id="viewForm1_ssCashApply_applyStatus"
																	data-dict-cate="cashApplyStatus" data-dict-code="dictItemList"
																	data-type-tag="radio" data-name="ssCashApply.applyStatus"
																	data-dict="cashApplyStatus"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请描述：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyReason"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">审核意见：</label></td>
														<td>
															<div class="form-group"><textarea
																	class="form-control clean"
																	rows="2" maxlength="1000"
																	data-temp-obj="ssCashApply.auditRemark"
																	data-temp-title="审核意见"
																	name="ssCashApply.auditRemark"></textarea></div>
														</td>
													</tr>
													</tbody>
												</table>
											</div>
											<!-- temp="viewForm1_content" end -->

										</form>
										<div class="form-group">
											<div class="col-sm-12">
												<div class="box-footer text-center">
													<button class="btn btn-danger pull-left" type="button" onclick="submitForm1('viewForm1','91');" data-temp-event="viewForm1_hidden"> 审核不通过 </button>
													<button class="btn btn-success pull-right" type="button" onclick="submitForm1('viewForm1','90');" data-temp-event="viewForm1_hidden"> 审核通过 </button>
												</div>
											</div>
										</div>
									</div>


								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>


			<div win-title="查看窗口" class="modal fade" id="my_modal_view2" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:40%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">查看详情</font> 
							</h4>
						</div>
						<div class="modal-body viewForm">

							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-view2">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabView_2">
										<form class="form-horizontal" role="form" id="viewForm2" action="javascript:void(0)">

											<!-- temp="addForm1_hidden" end -->
											<!-- temp="viewForm1_content" start -->
											<div id="viewForm2_content" class="row viewForm">
												<table class="table table-bordered bordercolor">
													<tbody>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请人账号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyEname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请人名称：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请提现金额：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.money"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">身份证号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCertNo"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">银行卡号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardNum"></span></div>
														</td>
													</tr>

													<tr>
														<td class="active" align="right"><label
																class="form-control-static">开户人姓名：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardName"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">开户银行：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyCardType"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">处理状态：</label></td>
														<td>
															<div class="form-control-static"><span
																	id="view2Form1_ssCashApply_applyStatus"
																	data-dict-cate="cashApplyStatus" data-dict-code="dictItemList"
																	data-type-tag="radio" data-name="ssCashApply.applyStatus"
																	data-dict="cashApplyStatus"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">申请描述：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.applyReason"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">审核人账号：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.auditUserEname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">审核人名称：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.auditUserCname"></span></div>
														</td>
													</tr>
													<tr>
														<td class="active" align="right"><label
																class="form-control-static">审核意见：</label></td>
														<td>
															<div class="form-control-static"><span
																	data-name="ssCashApply.auditRemark"></span></div>
														</td>
													</tr>
													</tbody>
												</table>
											</div>
											<!-- temp="viewForm1_content" end -->

										</form>
										<div class="form-group">
											<div class="col-sm-12">
												<div class="box-footer text-center">
													<button class="btn btn-success pull-right" type="button" onclick="mytools.closeModal('my_modal_view2');" data-temp-event="viewForm1_hidden"> 关闭 </button>
												</div>
											</div>
										</div>
									</div>


								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>
			<!-- Part 二、以下是template模板定义的模块区域 -->
			<script type="text/template" id="dataList-template">
				<? for ( var i = 0; i < rows.length; i++) {?>
				<tr>
					<td><?=(pageObj.currentPage-1)*10+(i+1)?></td>
					<!-- temp="dataList_template_content" start -->
					<td style='display:none;'><input type="hidden" name="input_primaryKey" obj-name="ssCashApply" primary="infoId" value="<?=strUtil.doNull(rows[i].ssCashApply.infoId,'')?>"/></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.applyCname,'')?></td>
					<td class="text-right">￥<?=fmoneyDoNull(rows[i].ssCashApply.money,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.applyCertNo,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.applyCardNum,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.applyCardName,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.applyCardType,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.auditUserCname,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.createTime,'')?></td>
					<td><?=strUtil.doNull(rows[i].ssCashApply.modifyTime,'')?></td>
					<td><?=dictListMap['cashApplyStatus'][strUtil.doNull(rows[i].ssCashApply.applyStatus,'')]?></td>
					<!-- temp="dataList_template_content" end -->

					<td>
						<button type="button" class="btn btn-success btn-xs" onclick="toLoad(this,'view2')"><i class="fa fa-search-plus"></i> 查看</button>  
						<?if('10'==rows[i].ssCashApply.applyStatus && checkUserType()){?>
						<button type="button" class="btn btn-danger btn-xs" onclick="toLoad(this,'view')"><i class="fa fa-search-plus"></i> 审核</button>  
						<?}?>
					</td>
					<
				</tr>
				<?}?>
			</script>

			<!-- Part 三、 以下是js模块区域 -->
			<script>
				var clickMenu = "cash-out-audit";
				var myPage,dataListId,searchFormId;
				myPage = 10;//定义列表数据
				dataListId = "dataList";//显示列表数据div的id
				searchFormId = "searchForm";//搜索表单Id
				var applyUserUserId = '${param.userId}';
				var loginUserType = '${loginUser.userType}';
				/**
				 * 初始化数据字典，id传入#id 返回值Map用法：dictListMap["userType"][rows[i].userType]
				 */
				var dictListMap = DictUtil.initDictAndDymic();

				$(function () {
					//1、加载分页列表数据
					getTableData();

					//2、控制是否启用token
					//setToken();

				});

				$(function () {
					//设置数据行选中效果
					$('#'+dataListId+' tbody').on('click','tr', function (e) {
						if ( $(this).hasClass('selected') ) {
						}
						else {
							$('tr.selected').removeClass('selected');
							$(this).addClass('selected');
						}
						//var id = $('tr.selected th').eq(0).html();
					} );
				});
				//注入日历框样式
				var dateObject = $('.datepicker').datepicker( {
					language : 'zh-CN',
					//inline: true,
					todayBtn : "linked",
					format : "yyyy-mm-dd",
					autoclose: true
				}).on('hide',function(e) {
					//bootstrap datepicker与bootstrapValidator同时使用时选择日期后无法正常触发校验的解决方法
					//当日期选择框关闭时，执行刷新校验。
					var fieldName = $(this).attr("name");//获取当前元素name
					var formId = $(this).parents("form").eq(0).attr("id");//获取当前元素所在父层级中的就近的formId
					$("#"+formId).data('bootstrapValidator').updateStatus(fieldName,'NOT_VALIDATED',null).validateField(fieldName);
				});

				//给模态窗口内form表单内的所有支持必填项的元素注入校验
				$(".modal").on('shown.bs.modal', function () {
					$(this).find("form").each(function(){
						var formId = $(this).attr("id");
						if(!strUtil.isNull(formId)){
							formId="#"+formId;
							setValidate(formId);//定义add表单验证属性
							mytools.cleanValidate(formId);//清空上次校验规则提示
						}
					});
				});

				function checkUserType(){
					var flag = false;
					if("manager"==loginUserType){
						flag=true;
					}
					return flag;
				}
				//打开添加modal
				function toAdd(){
					mytools.cleanData(".addFormBody");//清空表单元素上次填写的内容；
					$(".datepicker").val("");
					select_available_balance();//查询可提现余额
					$("#my_modal_add").modal("show");
				}

				function select_available_balance() {
					$.ajax({
						type:"get",
						url:common_info_url,
						data: {"pageName":"ss-user-balance","formName":"searchForm","ssUserBalance.w_userId":applyUserUserId},
						dataType:"json",
						async:false,
						success: function(myData){
							console.log(myData,"myData")
							var result = myData.flag;
							var availableBalance= myData.ssUserBalance.availableBalance;
							var applyEname= myData.ssUserBalance.userEname;
							var applyCname= myData.ssUserBalance.userCname;
							$("#addForm_available_balance").text(availableBalance);
							$("#addForm_apply_ename").text(applyEname);
							$("#addForm_apply_cname").text(applyCname);
							$("#addForm1").find("input[name='ssCashApply.applyEname']").val(applyEname);
							$("#addForm1").find("input[name='ssCashApply.applyCname']").val(applyCname);
						}
					});
				}

				//数据toLoad读取（查看、编辑）数据
				function toLoad(obj,type){
					if("view"==type){
						$("#my_modal_view").modal("show");
						mytools.cleanData("#viewForm1");
					}else if("view2"==type){
						mytools.cleanData("#viewForm2");
						$("#my_modal_view2").modal("show");
					}
					var paramLoadData = {};
					var inputPrimaryObj = $(obj).parent().parent().find("input[name='input_primaryKey']");
					paramLoadData["pageName"]=$("#searchForm").find("input[name='pageName']").val();
					paramLoadData["formName"]=$("#searchForm").find("input[name='formName']").val();
					if(inputPrimaryObj.length>0){
						for(var k=0;k<inputPrimaryObj.length;k++){
							var pkobj=$(inputPrimaryObj[k]);
							paramLoadData[pkobj.attr("obj-name")+".w_"+pkobj.attr("primary")]=pkobj.val();
						}
						$.get(common_info_url, paramLoadData,function(myData){
							console.log(myData);
							//反显加载数据
							if(myData){
								for(var objNameKey in myData){
									FormUtil.loadView(objNameKey, myData[objNameKey],"#my_modal_"+type);
								}
							}
						},"json");
					}
				}
				//删除调用
				function toDele(obj){
					if(!$("#delForm_hidden").find("input[name='formName']").val()){
						layer.alert("缺失删除参数！");
						return;
					}
					var index_submit = layer.confirm("您确定要删除信息吗？", {btn: ["Yes","No"],closeBtn: 0,offset: "220px"}
							, function(){
								layer.close(index_submit);
								var paramData = {};
								var inputPrimaryObj = $(obj).parent().parent().find("input[name='input_primaryKey']");
								paramData["pageName"]=$("#delForm_hidden").find("input[name='pageName']").val();
								paramData["formName"]=$("#delForm_hidden").find("input[name='formName']").val();
								if(inputPrimaryObj.length>0){
									for(var k=0;k<inputPrimaryObj.length;k++){
										var pkobj=$(inputPrimaryObj[k]);
										paramData[pkobj.attr("obj-name")+".w_"+pkobj.attr("primary")]=pkobj.val();
									}
									$.ajax({
										type:"post",
										url:common_submit_url,
										data: paramData,dataType:"json",
										success: function(myData){
											var result = myData.flag;
											if(result=="T"){
												refresh();
											}else{
												layer.alert("删除失败！");
											}
										}
									});
								}
							});
				}
				//加载列表数据
				function getTableData(){
					if(strUtil.isNull($("#"+searchFormId).find("input[name='pageName']").val())){return;}
					var beginDateVal = $("#searchForm").find("input[name='input_startDate']").val();
					var endDateVal = $("#searchForm").find("input[name='input_endDate']").val();
					if(!strUtil.isNull(beginDateVal)){
						$("#searchForm").find("input[name='ssCashApply.wb_modifyTime']").val(beginDateVal+","+endDateVal);
					}
					var index_load = layer.load(1, {shade: false});
					$.ajax({
						type:'get',
						url:common_list_url,
						data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
						dataType:'json',
						success: function(myData){
							console.log(myData);
							if("T"==myData.flag){
								var data = baidu.template(dataListId+"-template",eval(myData));
								$("#"+dataListId+"-body").html(data);
								var option= {
									ele:$("#"+dataListId+"-page")[0],
									total:myData.total,
									fn:getTableData,
									url:common_list_url+"?"+$("#"+searchFormId).serialize()
								}
								generatePages(option);

							}
							layer.close(index_load);
						}
					});
				}


				//提交tab1表单数据
				function submitForm1(formId,tabId){
					var msg = "您确定要保存信息吗？";
					//校验规则-表单提交时触发
					var validate = $('#'+formId).data('bootstrapValidator').validate();
					if(!validate.isValid()){ //如果校验不通过就返回
						return;
					}

					if("addForm1"==formId){
						var availableBalance = $("#addForm_available_balance").text();
						var money = $("#"+formId).find("input[name='ssCashApply.money']").val();

						if(parseFloat(money)>parseFloat(availableBalance)){
							layer.alert("申请提现金额不能大于剩余金额，请重新输入");
							return;
						}
					}else if("viewForm1"==formId){
						if("91"==tabId){
							var auditRemark = $("#"+formId).find("textarea[name='ssCashApply.auditRemark']").val();
							if(auditRemark<=0){
								layer.alert("请填写审核意见");
								return;
							}
							msg ="您确定审核不通过吗？";
							$("#"+formId).find("input[name='ssCashApply.applyStatus']").val(tabId);
						}else{
							msg= "您确定审核通过吗？";
						}
					}


					var index_submit = layer.confirm(msg, {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
							, function(){
								var result = submitForm(formId,tabId);
								if(result){
									layer.alert("提交成功！", {closeBtn: 0 });
									mytools.closeModal("my_modal_add");
									mytools.closeModal("my_modal_edit");
									mytools.closeModal("my_modal_view");
									refresh();


									setToken();
									if(!strUtil.isNull(tabId)){
										$('.nav-tabs a[href=\"#'+tabId+'\"]').tab('show'); // Select tab by name
									}
								}
							});

				}
				//提交表单数据
				function submitForm(formId,tabId){
					var result;
					var index_load = layer.load(1, {shade: false});
					$.ajax({
						type:'post',
						url:common_submit_url,
						data:$("#"+formId).serialize(),
						async:false,
						dataType:'json',
						success: function(myData){
							console.log(myData);
							if(myData.flag=="T"){
								result = myData;
							}else{
								setToken();
								layer.alert(myData.msg);
							}
							layer.close(index_load);
						},
						error: function (e) {
							layer.close(index_load);
						}
					});
					return result;
				}
				function toExport() {
					var index_load = layer.load(1, {shade: false});
					$.ajax({
						type: 'post',
						url: "${ctx}/outCashExcel",
						data: $("#" + searchFormId).serialize(),
						dataType: 'json',
						success: function (myData) {
							layer.close(index_load);
							console.log(myData,"outexcel");
							// var downloadUrl = 'http://'+hostname+':11080/atta/labf/out12345Test.xls'
							window.open(myData.msg);
						}
					})
				}

				function toBack() {
					var reqUrl2=page_admin+"/yjgl/yjgl-list";
					mytools.pjax(reqUrl2);
				}
				//刷新
				function refresh(){
					getTableData();
				}
				//设置token
				function setToken(){
					$.ajax({
						type:'get',
						url:'${ctx}/sendPage/token?token=true',
						dataType:'text',
						success: function(myData){
							console.log(myData);
							$('.formToken').val(myData);
						}
					});
				}


				/**** Part 四、以下是自定义新增方法  ****/
//1.定义校验规则-定义
				function setValidate(id){
					$(id).each(function(){
						$(this).bootstrapValidator({
							feedbackIcons: {
								valid: 'glyphicon glyphicon-ok',
								invalid: 'glyphicon glyphicon-remove',
								validating: 'glyphicon glyphicon-refresh'
							},/** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
							fields:{
								/** 可自定义新增验证规则
								 "uctUser.userEname":{
		    		 validators: {
		    			 regexp: {
		    				 regexp: /^[0-9]+$/,
		                      message: '只能是数字'
		                  }
		              }
		    	}
								 **/
							}
						});
					});
				}

				function getStartEndByDate(type) {
					var dataJson = mytools.getDateByType(type);
					$("#searchForm").find("input[name='input_startDate']").val(dataJson.beginDate);
					$("#searchForm").find("input[name='input_endDate']").val(dataJson.endDate);
				}
			</script>
		</section>
		<!-- Main end -->
	</div>
	<!-- foot start -->
	<%@include file="/common/ssb/foot.jsp" %>
	<!-- foot start -->
</div>
<!-- /.content-wrapper -->
</body>
</html>












